<template>
  <div>
    <van-cell>
      <div class="flex-between col-333333">
        <div class="m-r-10" style="width: 26%"><span style="color: #ff3b30">*</span>保险理赔日期</div>
        <div class="line-text-out text-right" style="width: 68%">
          {{  list.settlementDate.substring(0, 10) }}
        </div>
      </div>
    </van-cell>
    <van-cell>
      <div class="flex-between col-333333">
        <div class="m-r-10" style="width: 40%"><span style="color: #ff3b30">*</span>保险名称</div>
        <div class="line-text-out text-right" style="width: 68%">
          {{ list.insuranceName }}
        </div>
      </div>
    </van-cell>
    <van-cell>
      <div class="flex-between col-333333">
        <div class="m-r-10" style="width: 40%"><span style="color: #ff3b30">*</span>理赔数量（只）</div>
        <div class="line-text-out text-right" style="width: 68%">
          {{ list.settlementNum }}
        </div>
      </div>
    </van-cell>
    <van-cell>
      <div class="flex-between col-333333">
        <div class="m-r-10" style="width: 40%">理赔金额（元）</div>
        <div class="line-text-out text-right" style="width: 68%">
          {{ list.settlementAmount }}
        </div>
      </div>
    </van-cell>

    <div class="m-b-10 shop">
      <div class="flex-between bottom content font-14 line-height-2">
        <div class="col-8686 text-center footerImg" @click="goCompile" style="width: 50%">
          <img src="../../assets/img/bianji.png" alt="" />
          编辑
        </div>
        <div class="col-8686 text-center footerImg" @click="deleteContent" style="width: 50%">
          <img src="../../assets/img/shanchu.png" alt="" />
          删除
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import {
  Form,
  Field,
  Calendar,
  RadioGroup,
  Radio,
  Dialog,
  Toast,
  DatetimePicker,
  Picker,
  Button,
  Icon,
  Cell,
  Popup,
  Image
} from 'vant'
import dayjs from 'dayjs'

import { getValue, setValue, setObject } from '@/utils/auth'
import { postHandle, getHandle } from '@/api'
export default {
  components: {

    [Form.name]: Form,
    [Field.name]: Field,
    [Calendar.name]: Calendar,
    [RadioGroup.name]: RadioGroup,
    [Radio.name]: Radio,
    [Picker.name]: Picker,
    [DatetimePicker.name]: DatetimePicker,
    [Button.name]: Button,
    [Icon.name]: Icon,
    [Popup.name]: Popup,
    [Toast.name]: Toast,
    [Cell.name]: Cell,
    [Dialog.Component.name]: Dialog.Component,
    [Image.name]: Image,
    [Dialog.name]: Dialog
  },
  data() {
    return {
      list: [],
      imgs: '',
      fileInfoList: [],
      contentObj: {},
      flag: true,
      objGlobal: {
        id: '',
        loginUserId: '',
        tenantCode: '',
        productBatchId: '',
        token: ''
      }
    }
  },
  created() {
    this.getViewData()
  },
  mounted() {},
  methods: {
    // 查看页面数据请求
    getViewData() {
      getHandle(`/agri/api/yzbzh/claimSettlementRecord/queryDetail/${getValue('grow-view-id')}`).then(res => {
        console.log(res)
        this.list = res.data
      })
    },
    getContent() {},
    goCompile() {
      this.$bridge.call('insuranceSettlemenEdit')
    },

    beforeClose(action, done) {
      if (action === 'confirm') {
        setTimeout(() => {
          postHandle(`/agri/api/yzbzh/claimSettlementRecord/delete/${getValue('grow-view-id')}`).then(res => {
            if (res.status == '0') {
              this.$toast(res.msg)
              done()
             this.$bridge.call('base.closePage')
            } else {
              this.$toast(res.msg)
              done()
            }
          })
        }, 1000)
      } else {
        done()
      }
    },
    deleteContent() {
      Dialog.confirm({
        title: '提示',
        message: '确定要删除吗',
        beforeClose: this.beforeClose
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.van-cell {
  line-height: 40px;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  line-height: 2em;
}
.m-r-10 {
  margin-right: 10px;
}
.line-text-out {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}
.col-1b1b {
  color: #1b1b1b;
}
.col-8686 {
  color: #868686;
}
::v-deep .van-cell {
  border-bottom: none;
}
.imgstyle::after {
  content: '';
  width: 100px;
}
.footerImg {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #37b5b5;
  > img {
    width: 22px;
    height: 22px;
  }
}
.shop .bottom {
  position: fixed;
  bottom: 0;
  height: 68px;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  padding: 8px 10px 8px 14px;
  box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bthStyle {
  width: 56px;
  height: 20px;
  border-radius: 10px;
  border: 1px solid #2871fe;
}
.addbtn {
  width: 50px;
  height: 24px;
  font-size: 13px;
  padding: 0;
  margin-top: 2px;
}
</style>
